package com.dreamstations.changshads.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.LinearLayout;

import com.dreamstations.changshads.R;
import com.dreamstations.changshads.activity.SectionActivity;

import java.util.ArrayList;

/**
 * Created by 7YHong on 2016/6/19.
 */
public class HomeNavigationAdapter extends BaseAdapter {
    private Context context;
    private int[] imageRes = new int[]{R.drawable.nav_figure_gray
            , R.drawable.nav_story_gray
            , R.drawable.nav_resource_gray
            , R.drawable.nav_library_gray};
    private int[] menuIds = new int[]{SectionActivity.SECTION_FIGURE
            , SectionActivity.SECTION_STORY
            , SectionActivity.SECTION_RESOURCE
            , SectionActivity.SECTION_LIBRARY};

    public HomeNavigationAdapter(Context context) {
        this.context = context;
    }

    @Override
    public int getCount() {
        return imageRes.length;
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return menuIds[position];
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        if (convertView == null) {
            convertView = LayoutInflater.from(context).inflate(R.layout.home_nav_item, parent, false);
        }
        ((ImageView) convertView.findViewById(R.id.nav_list_item)).setImageResource(imageRes[position]);
        return convertView;
    }
}
